/**
 * 
 */
package com.java.test.timer;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.stereotype.Component;

/**
 * @author 推送跑马灯定时任务
 *
 */
@Slf4j
@Component
@EnableScheduling
public class HorseRaceLampPushTimer {
	/*@Value("${get.game.offLineUser.url}")
	String offLineUserUrl;

	@Autowired
	MessageCenterService messageCenterService;

	//要停止运行的跑马灯
	public static List<Integer> idListStop = new ArrayList<>();
	//页面公告删除
	public static List<String> pageAnnouncementListStop = new ArrayList<>();
	//线程标识
	public static Map<String,Integer> threadFlag = new HashMap<>();
	//线程暂停
	public static Map<String,Integer> sleepVal = new HashMap<>();

	public void run() {
		JSONObject data=new JSONObject();
		data.put("code",2);
		List<NoticeInfo> list = messageCenterService.selectHorseRaceLampPushList();
		Integer version = 0;
		for (NoticeInfo entity:list) {
			version = threadFlag.get(entity.getId()+"")==null?0+1:threadFlag.get(entity.getId()+"")+1;
			threadFlag.put(entity.getId()+"",version);
			String base64Sign = new String(Base64.getEncoder().encode(entity.getContent().getBytes()));
			JSONArray stra=new JSONArray();
			stra.put(base64Sign);
			int powerType = 0;
			if(entity.getPowerType()==2){
				powerType= 1;
			}else if(entity.getPowerType()==3){
				powerType = 2;
			}
			stra.put(powerType);
			stra.put(-1);
			stra.put(Long.toString(entity.getId()));
			data.put("data",stra);
//			Duration oldTimeD = Duration.between(entity.getStartTime(),entity.getEndTime());//数据库开始时间到结束时间
//			long oldTime = oldTimeD.toMillis();//获取时间戳
//			double oldCustomerSleep = ArithUtil.div(oldTime,entity.getRollNumber());//停止毫秒
//			long customerSleep = new Double(oldCustomerSleep).longValue();//停止毫秒
//			Duration nowTimeD = Duration.between(LocalDateTime.now(),entity.getEndTime());//当前时间到结束时间
//			long nowTime = nowTimeD.toMillis();//时间戳
//			double rollNumberD = Math.ceil(ArithUtil.div(nowTime,customerSleep));//当前时间到结束时间要发送的次数
//			int rollNumber = new Double(rollNumberD).intValue();//次数
            HorseRaceLampDTO horseRaceLampDTO = new HorseRaceLampDTO();
            horseRaceLampDTO.setCustomerSleep(0);//等待时间
            horseRaceLampDTO.setData(data.toString());//数据
            horseRaceLampDTO.setEntityId(entity.getId());//id
            horseRaceLampDTO.setMessageCenterService(messageCenterService);//service
            horseRaceLampDTO.setOffLineUserUrl(offLineUserUrl);//地址
            horseRaceLampDTO.setRollNumber(1);//次数
			horseRaceLampDTO.setVersion(version);//版本
			ProducerCustomerModelUsingBlockedQueue.push(horseRaceLampDTO);
		}
	}*/
}
